package com.groupbuying.redpacket.constants;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @ClassName RedisConstans
 * @Description: TODO   redis  常量
 * @Author srlg3
 * @Date 2019/11/15
 * @Version V1.0
 **/
@Component
public class RedisConstans {

    /**红包控制参数前缀*/
    public static String RED_PACKAGE_CONTROL = "";

    /**红包控制参数前缀(用于结算页面)*/
    public static String RED_PACKAGE_CONTROL_SETTLE = "";

    /**红包验证码控制参数前缀*/
    public static String RED_PACKAGE_CODE = "RedPacketMessage_";

    /**是否有定时任务在执行*/
    public static final String RED_PACKAGE_HAS_TIMER = "RED_PACKAGE_HAS_TIMER";

    /**用户锁前缀*/
    public static final String USER_LOCK = "user_lock_";

    /**用户锁超时时间*/
    public static final int USER_LOCK_EXP = 5;

    public String getRedPackageControl() {
        return RED_PACKAGE_CONTROL;
    }


    @Value("${redPacket.eventId}")
    public void setRedPackageControl(String redPackageControl) {
        RedisConstans.RED_PACKAGE_CONTROL = redPackageControl;
        RED_PACKAGE_CONTROL_SETTLE = redPackageControl + "settle";
    }

}
